<%--/*
- * @description: 管理员首页
- * @author: huangchuting
- * @update: huangchuting (2021/1/10 13:27)
- */--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>校园租赁-管理员首页</title>
</head>
<link rel="stylesheet" href="/static/css/public.css">
<link rel="stylesheet" href="/static/css/admin-index.css">
<script type="text/javascript" src="/static/js/changeDiv.js"></script>
<body>
    <div class="headWarp">
        <div class="logoWarp">
            <img src="/static/images/public/school_logo.png" class="sLogo">
            <img src="/static/images/public/school_name.png" class="sName">
            <span class="shopName">管理员后台管理系统</span>
            <span class="saying">敦品励学，求事督行</span>
        </div>
             <div class="aNameWarp">
                 <img src="/static/images/public/manager.png" class="managerImg">
                 <span class="adminName">  <%=session.getAttribute("admin_name")%>
                     | <a href="/User/outLogin">退出</a>
             </div>
    </div>
    <hr style="height:2px;width:100%;border:none;border-bottom:1px solid #127698;float: left;" />
    <div class="Warp">
        <div class="navWarp">
            <ul>
                <li id="navUser"><a href="javascript:HideOrShowFont3('navUser','navItem','navOrder')" onclick="change_div3('manUser', 'manItem', 'manOrder')">用户管理</a></li>
                <li id="navItem"><a href="javascript:HideOrShowFont3('navItem','navUser','navOrder')" onclick="change_div3('manItem', 'manUser', 'manOrder')">商品管理</a></li>
                <li id="navOrder"><a href="javascript:HideOrShowFont3('navOrder','navUser','navItem')" onclick="change_div3('manOrder', 'manUser', 'manItem')">订单管理</a></li>
                <li>
                    <span class="navCopyright">关于我们，联系我们</span><br>
                    <span class="navCopyright">©2021 版权所有 by 黄楚婷</span><br>
                    <span class="navCopyright">| 邮箱  2359220243@qq.com</span><br>
                </li>
            </ul>
        </div>
        <div class="contentWarp">
            <div class="content" id="manUser">
                <h3>用户管理</h3>
                <table>
                    <tr>
                        <th>用户编号</th>
                        <th>用户名</th>
                        <th>用户电话</th>
                        <th>管理员</th>
                        <th>操作</th>
                    </tr>
                    <td colspan="5">
                        <hr style="height:2px;border:none;border-bottom:1px solid #127698;">
                    </td>
                   <c:forEach items="${userList}" var="var" varStatus="vs">
                       <tr>
                           <td> ${var.user_id}</td>
                           <td> ${var.user_name}</td>
                           <td> ${var.phone}</td>
                           <td>${var.manager} </td>
                           <td>
                                <a href="/User/deleteUser?user_id=${var.user_id}" class="manBtn"><div class="manBtn">删除用户</div></a>
                           </td>
                       </tr>
                   </c:forEach>
                </table>
            </div>
            <div class="content" id="manItem">
                <h3>商品管理</h3>
                <table>
                    <tr>
                        <th>商品编号</th>
                        <th>卖家编号</th>
                        <th>商品名称</th>
                        <th>类型</th>
                        <th>价格</th>
                        <th>当前状态</th>
                        <th>操作</th>
                    </tr>
                    <td colspan="7">
                        <hr style="height:2px;border:none;border-bottom:1px solid #127698;">
                    </td>
                    <c:forEach items="${itemList}" var="var" varStatus="vs">
                        <tr>
                            <td><a href="/Item/item-news?item_id=${var.item_id}">${var.item_id}</a></td>
                            <td>${var.user_id}</td>
                            <td>${var.item_name}</td>
                            <td>${var.type}</td>
                            <td>${var.price}</td>
                            <c:if test="${var.item_state==1}">
                                <td><span style="color: crimson">[未售出]</span></td>
                            </c:if>
                            <c:if test="${var.item_state==0}">
                                <td><span>[已售出]</span></td>
                            </c:if>
                            <td>
                                <c:if test="${var.item_state==1}">
                                <a class="manBtn" href="/Item/deleteItem?item_id=${var.item_id}"><div class="manBtn">删除商品</div></a>
                                </c:if>
                                <c:if test="${var.item_state==0}">
                                <a class="manBtn" href="#"><div class="manBtn" style="background: darkgray">删除商品</div></a>
                                </c:if>

                        </tr>
                    </c:forEach>
                </table>
            </div>
            <div class="content" id="manOrder">
                <h3>订单管理</h3>
                <table >

                    <tr>
                        <th>订单编号</th>
                        <th>&#12288;商品编号</th>
                        <th>&#12288;买家编号</th>
                        <th>商品名称</th>
                        <th>订单价格</th>
                        <th>当前状态</th>
                        <th>操作</th>
                    </tr>
                    <tr>
                        <td colspan="7">
                            <hr style="height:2px;border:none;border-bottom:1px solid #127698;">
                        </td>
                    </tr>
                    <c:forEach items="${ordersList}" var="var" varStatus="vs">
                        <tr>
                            <td><a href="/Order/orderCommit?order_id=${var.order_id}">${var.order_id}</a></td>
                            <td>${var.item_id}</td>
                            <td>${var.user_id}</td>
                            <td>${var.item_name}</td>
                            <td>${var.order_price}</td>

                            <c:if test="${var.order_state==1}">
                                <td><span style="color: crimson">[未完成]</span></td>

                            </c:if>
                            <c:if test="${var.order_state==0}">
                                <td><span>[已完成]</span></td>
                            </c:if>
                            <td>
                                <c:if test="${var.order_state==0}">
                                <a href="/Order/userDeleteOrder?order_id=${var.order_id}" class="manBtn"><div class="manBtn">删除订单</div></a>
                                </c:if>
                                <c:if test="${var.order_state==1}">
                               <div class="manBtn" style="background: darkgray">删除订单</div>
                                </c:if>
                        </tr>
                    </c:forEach>
                </table>
            </div>

        </div>
    </div>
</body>
</html>
